workflow = jQuery.noConflict();
workflow().ready(function() {		

  workflow("#workflow-tab-form").validate({	
										 
					rules: {
						   'workflow_comment[und]': { 
							required: true,
							maxlength: 625,
							chkbadchar:true,							
						},
						
						
					
					},
                    messages: {
						    'workflow_comment[und]':{						  
							maxlength:  'Maximum 625 character only allowed',
							chkbadchar: 'insert, select, update, delete, drop, alter, change, modify not allowed.',						
							},
							
							
							
							
	
				}, 
					//errorLabelContainer: "#errormsg_container",
					 //focusInvalid: false,
   					invalidHandler: function(form, validator) {
						
						//alert(validator[0].);
						
       
       					 if (!validator.numberOfInvalids())
						 		
								return;
						else{
							
							  //$("#actform-node-form").create_errormsg_container('errormsg_container','actform-node-form');
						}
							
							$('html, body').animate({
								scrollTop: $(validator.errorList[0].element).offset().top - 100
							}, 1000);
							
							//alert(validator.errorList[0].element);
							
						},
				

   
	});
 /*errorLabelContainer: "#announcements-node-form",
						wrapper: "li",
  
	});
/*  errorPlacement: function(error, element) {
        element = element.closest('li');
        element = element.children(':first-child');
        error.insertBefore(element);
        error.addClass('message');
        $(function() {                                 // my function
            var errorIndex = $(error).index('div');
            var errorId = 'errordiv' + errorIndex.toString();
            $(error).attr('id', errorId);
            $('.errorList').append('<li><a href="#' + errorId + '">' + $(error).text() + '</a></li>');
			$("#announcements-node-form").before(element);
        });    
    },
*/

//// Title Validation
//    $('#edit-title').rules("add", { 
//    		//notaccept: {'exp':"[a-zA-Z]+"},
//			chkbadchar: true,
//    		//required: true,
//         	minlength: 0,
//         messages: {
//            // required: "Title is required"  ,
//           // notaccept: 'Number is Not Allowed',
//			chkbadchar:'blah blah'
//         }
//        
//     });
var $curr= $(".workflow-current-state span.state").html();
$(".form-radios .form-type-radio").each(function(){
 $(this).find(".option:contains("+$curr+")").parent().css("display","none");
});
            
});
